package cn.stylefeng.guns.generator.engine.config;

import cn.stylefeng.guns.generator.executor.config.GunsGeneratorConfig;
import lombok.Data;

/**
 * Dao模板生成的配置
 *
 * @author fengshuonan
 * @date 2017-05-07 22:12
 */
@Data
public class DaoConfig {

    private cn.stylefeng.guns.generator.executor.config.GunsGeneratorConfig gunsGeneratorConfig;

    private String daoPathTemplate;
    private String xmlPathTemplate;

    private String packageName;

    public DaoConfig(GunsGeneratorConfig gunsGeneratorConfig) {
        ContextConfig contextConfig = gunsGeneratorConfig.getContextConfig();
        this.daoPathTemplate = "/src/main/java/" + gunsGeneratorConfig.getContextConfig().getProPackage().replaceAll("\\.", "/") + "/modular/" + contextConfig.getModuleName() + "/dao/{}Dao.java";
        this.xmlPathTemplate = "/src/main/java/" + contextConfig.getProPackage().replaceAll("\\.", "/") + "/modular/" + contextConfig.getModuleName() + "/dao/mapping/{}Dao.xml";
        this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".dao";
    }

}
